{extend name="admin@index_layout"/}
{block name="main"}
<form class="layui-form" method="post">
    <input type="hidden" name="row[id]" value="{$data.id}">
    <div class="layui-form-item">
        <label class="layui-form-label">资产类型</label>
        <div class="layui-input-block">
            <select name="row[cate_id]">
                <option value="">请选择资产类型</option>
                {if !empty($type_list)}
                {foreach $type_list as $key}
                <option <?php if( $key['id'] == $data['cate_id']){ ?> selected <?php }?> value="{$key.id}"  name="row[cate_id]">{$key.name}</option>
                {/foreach}
                {/if}
            </select>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">公告状态</label>
        <div class="layui-input-block">

            <input type="radio" name="row[xm_type]" value="1" title="竞价项目">

            <input type="radio" name="row[xm_type]" value="2" title="推介项目" checked>

        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">公告名称</label>
        <div class="layui-input-block">
            <input type="text" name="row[name]" lay-verify="required" autocomplete="off" placeholder="公告名称" class="layui-input"
                   value="{$data.name}" >
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label ">开始时间</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input datetime" name="row[start_time]" placeholder="开始时间" value="{$data.start_time}" >
        </div>
    </div>

    <!--    <div class="layui-form-item">-->
    <!--        <label class="layui-form-label">联系电话</label>-->
    <!--        <div class="layui-input-block">-->
    <!--            <input type="text" name="row[phone]" autocomplete="off" placeholder="联系电话" class="layui-input"-->
    <!--                   value="{$data.phone}" >-->
    <!--        </div>-->
    <!--    </div>-->

    <div class="layui-form-item">
        <label class="layui-form-label">省</label>
        <div class="layui-input-block">
            <select name="row[province]" lay-verify="required" lay-filter="ccc62">
                <option value="">请选择省</option>
                {volist name="proviec" id="vo"}
                <!--                <option  value="{$key.id}"  name="row[operate_type]">{$key.name}</option>-->
                <option value="{$vo.name}" <?php if( $vo['name'] == $data['province']){ ?> selected <?php }?>>{$vo.name}</option>
                {/volist}
            </select>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">市</label>
        <div class="layui-input-block">
            <select id="c-city" name="row[city]" lay-verify="required" lay-filter="c-city">
                <option value="">请选择市</option>
                {volist name="city_list" id="vo"}
                <option value="{$vo.name}" <?php if( $vo['name'] == $data['city']){ ?> selected <?php }?>>{$vo.name}</option>
                {/volist}
            </select>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">区</label>
        <div class="layui-input-block">
            <select id="c-city2" name="row[area]" lay-verify="required" lay-filter="c-city2">
                <option value="">请选择区</option>
                {volist name="area_list" id="vo"}
                <option value="{$vo.name}" <?php if( $vo['name'] == $data['area']){ ?> selected <?php }?>>{$vo.name}</option>
                {/volist}
            </select>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">详情地址</label>
        <div class="layui-input-block">
            <input type="text" name="row[address]" lay-verify="required" autocomplete="off" placeholder="详情地址:xx路xx号或xx镇xx村" class="layui-input"
                   value="{$data.address}">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">小区名称/村名</label>
        <div class="layui-input-block">
            <input type="text" name="row[community]"  autocomplete="off" placeholder="小区名称/村名" class="layui-input"
                   value="{$data.community}" >
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">小区楼牌号/村户号</label>
        <div class="layui-input-block">
            <input type="text" name="row[community_detail]"  autocomplete="off" placeholder="小区楼牌号/村户号" class="layui-input"
                   value="{$data.community_detail}" >
        </div>
    </div>


    <div class="layui-form-item">
        <label class="layui-form-label">图片（建议750 x 460）</label>
        <div class="layui-input-block">
            <div class="w300">
                <input value="{$data.img}" type="text" lay-verify="required" name="row[img]" id="c-pic3"
                       class="layui-input">
            </div>
            <button type="button" class="layui-btn faupload" id="faupload-pic2" data-multiple="false"
                    data-input-id="c-pic3"
                    data-preview-id="p-pic3" data-type="image"><i class="layui-icon layui-icon-upload"></i> 上传
            </button>
            <button type="button" class="layui-btn fachoose" data-multiple="false" data-mimetype="image"
                    data-input-id="c-pic3" id="fachoose-c-pic2"><i class="iconfont icon-other"></i> 选择
            </button>
            <ul class="layui-row list-inline plupload-preview" id="p-pic3"></ul>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">链接</label>
        <div class="layui-input-block">
            <input type="text" name="row[url]" lay-verify="required" autocomplete="off" placeholder="链接" class="layui-input"
                   value="{$data.url}" >
        </div>
    </div>


    <div class="layui-form-item">
        <label class="layui-form-label">参考价值</label>
        <div class="layui-input-block">
            <input type="number" name="row[reference_value]" lay-verify="required" autocomplete="off" placeholder="参考价值"
                   class="layui-input"
                   value="{$data.reference_value}">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">债权利息</label>
        <div class="layui-input-block">
            <input type="number" name="row[debt_interest]" lay-verify="required" autocomplete="off" placeholder="债权利息"
                   class="layui-input"
                   value="{$data.debt_interest}">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">公告状态</label>
        <div class="layui-input-block">

            <input type="radio" name="row[status]" value="0" title="招商中" {if $data.status==0}checked{/if}>

            <input type="radio" name="row[status]" value="1" title="招商结束" {if $data.status==1}checked{/if}>

        </div>
    </div>


    <div class="layui-form-item layer-footer">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit>提交</button>
        </div>
    </div>
</form>
{/block}
{block name="script"}
<script type="text/javascript">
    layui.use(['yznForm', 'laydate','form'], function () {
        var yznForm = layui.yznForm,
            laydate = layui.laydate;
        var form = layui.form;
        yznForm.bindevent($("form.layui-form"));
        laydate.render({
            elem: '#ID-laydate'
        });
        form.on('select(ccc6)', function (data) {
            console.log(data.value);
            if (data.value == 3) {
                $(".c5").show();
            } else{
                $(".c5").hide();
            }
            form.render();
        });

        form.on('select(ccc62)', function (data) {
            console.log(data.value);
            $.ajax({
                type: "POST",//规定传输方式
                url: "{:url('getc_cate')}",//提交URL
                data: {'id': data.value},//提交的数据
                success: function (result) {
                    if (result.code == 200) {
                        $("#c-city").empty();
                        var str = "<option value>请选择市</option>";
                        $.each(result.data, function (i, val) {
                            str += '<option value=' + val.name + '>' + val.name + '</option>'
                        });
                        $("#c-city").append(str);

                        $("#c-city2").empty();
                        var str2 = "<option value>请选择区</option>";
                        $("#c-city2").append(str2);

                        layui.form.render('select');
                    }
                },
                error: function () {
                    alert("获取信息失败")
                }
            });
            form.render();
        });

        form.on('select(c-city)', function (data) {
            $.ajax({
                type: "POST",//规定传输方式
                url: "{:url('getc_cate')}",//提交URL
                data: {'id': data.value},//提交的数据
                success: function (result) {
                    if (result.code == 200) {

                        $("#c-city2").empty();
                        var str = "<option value>请选择区</option>";
                        $.each(result.data, function (i, val) {
                            str += '<option value=' + val.name + '>' + val.name + '</option>'
                        });
                        $("#c-city2").append(str);
                        layui.form.render('select');
                    }
                },
                error: function () {
                    alert("获取信息失败")
                }
            });
            form.render();
        });

    });
</script>
{/block}